<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<div class="page_right combopage_right">
    <ul class="combopage_combolist">
        <c:forEach items="${comboList}" var="data" varStatus="status">
            <li>
                <p>
                    <i>${status.count}</i>
                    <span>${data.money} 元<span>${data.coin}</span> 币</span>
                    <%--<a class="combopage_comboeditbtn" href="javascript:;">编辑</a>--%>
                </p>
                <%--<div class="combo_edit">
                    <span>套餐币数：</span>
                    <input type="number" value="${data.coin}" name="${data.discountid}">
                    <a class="combopage_comboeditsave" href="javascript:;">保存</a>
                </div>--%>
            </li>
        </c:forEach>
    </ul>
</div>
<script type="application/javascript">
    $(".combopage_comboeditsave").on("click", function(){
        var combo_editvalue=parseInt($(this).prev("input").val());
        var discount=$(this).prev("input").attr("name");
        if(combo_editvalue>999){
            combo_editvalue=999;
        }
        $(this).prev("input").val(combo_editvalue);
        if(combo_editvalue>0){
            $(this).prev("input").css("box-shadow","none");
            $(this).parent().prev("p").children("span").children("span").text(combo_editvalue);
            $(this).parent().css({"transition":"all 0.3s","left":"950px","opacity":"0","z-index":"-1"});
            $.ajax({
                url:'${basePath}v2/combo/editCoin',
                type : 'POST',
                data : {"discountId":discount,'comboCoin':combo_editvalue},
                success: function (ret) {
                    if(ret.result==false) {
                        alert(ret.info);
                    }
                }
            });
        }else{
            $(this).prev("input").css("box-shadow","0 0 3px 1px #f00");
        }
    });
</script>
